{% extends 'layouts/base.html' %}
{% load static i18n %}

{% block content %}
  <div class="row">
    <div class="col-sm-8 offset-sm-2">
      <div class="card">
        <div class="card-header">
          <h5>{% if form.instance.pk %}{% trans 'Editar Endereço' %}{% else %}{% trans 'Cadastrar Endereço' %}{% endif %}</h5>
        </div>
        <div class="card-body">
          <form method="post">
            {% csrf_token %}
            <div class="row">
              <div class="col-sm-12 mb-4">
                <div class="form-group">
                  <label for="street">{% trans 'Logradouro' %}</label>
                  {{ form.street }}
                </div>
              </div>
              <div class="col-sm-6 mb-4">
                <div class="form-group">
                  <label for="number">{% trans 'Número' %}</label>
                  {{ form.number }}
                </div>
              </div>
              <div class="col-sm-6 mb-4">
                <div class="form-group">
                  <label for="complement">{% trans 'Complemento' %}</label>
                  {{ form.complement }}
                </div>
              </div>
              <div class="col-sm-6 mb-4">
                <div class="form-group">
                  <label for="neighborhood">{% trans 'Bairro' %}</label>
                  {{ form.neighborhood }}
                </div>
              </div>
              <div class="col-sm-6 mb-4">
                <div class="form-group">
                  <label for="city">{% trans 'Cidade' %}</label>
                  {{ form.city }}
                </div>
              </div>
              <div class="col-sm-6 mb-4">
                <div class="form-group">
                  <label for="state">{% trans 'Estado' %}</label>
                  {{ form.state }}
                </div>
              </div>
              <div class="col-sm-6 mb-4">
                <div class="form-group">
                  <label for="postal_code">{% trans 'CEP' %}</label>
                  {{ form.postal_code }}
                </div>
              </div>
            </div>
            <button type="submit" class="btn btn-primary">{% trans 'Salvar' %}</button>
            <a href="{% url 'profile' %}" class="btn btn-secondary">{% trans 'Cancelar' %}</a>
          </form>
        </div>
      </div>
    </div>
  </div>
{% endblock %}
